from flask_login import UserMixin
from sqlalchemy.dialects.mysql import LONGTEXT
from flask_sqlalchemy import SQLAlchemy


db = SQLAlchemy()

class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(length=10), unique=False)
    password = db.Column(db.String(length=12))
    city = db.Column(db.String(length=2))
    hobby = db.Column(db.String(length=10))
    sex = db.Column(db.Enum('MAN', 'WOMAN'))
    text = db.Column(LONGTEXT())


class Student(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(10), unique=True)
    chinese = db.Column(db.Integer)
    math = db.Column(db.Integer)
    english = db.Column(db.Integer)